﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AgileDashboard.Services;
using AgileDashboard.Entities;

namespace PlanningPokerMVC.Controllers
{
    public class WorkItemController : Controller
    {
        //
        // GET: /WorkItem/

        public ActionResult Index()
        {
            TfsDataLoaderService service = new TfsDataLoaderService();

            //Project proj = service.GetTeamProjectByName("Max Phase 2");


            List<TfsProject> projects = service.GetTeamProjects();


            return View();
        }

        //
        // GET: /WorkItem/Details/5

        public ActionResult Details(int id)
        {
            return View();
        }

        //
        // GET: /WorkItem/Create

        public ActionResult Create()
        {
            return View();
        } 

        //
        // POST: /WorkItem/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        //
        // GET: /WorkItem/Edit/5
 
        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /WorkItem/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /WorkItem/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /WorkItem/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

    }
}
